package com.lzw.mapper.admin;

import com.lzw.pojo.Building;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface BuildingManagementMapper {

    //查询楼宇
    List<Building> listBuildings(@Param("name") String name, @Param("address") String address);

    //添加楼宇
    @Insert("INSERT INTO dormitorymanagement.building (name, address) VALUES (#{name}, #{address})")
    void addBuilding(Building building);

    //删除楼宇
    void deleteBuilding(@Param("ids") List<Integer> ids);

    //根据id查询楼宇
    @Select("SELECT * FROM dormitorymanagement.building WHERE building_id = #{buildingId}")
    Building getBuildingById(int id);

    //更新楼宇
    void updateBuilding(Building building);

    @Select("SELECT COUNT(*) FROM dormitorymanagement.building WHERE name = #{name}")
    int countByName(String name);
}
